using System;
using System.Collections.Generic;
using System.Text;
using SharksHunter.TransferObjects.Presentation;

namespace SharksHunter.UI.Controls
{
    public class SelectedOpenFileProvider: Abstract.ParamProvider
    {
        private string _filter = "";
        private bool _multisel = false;
        public SelectedOpenFileProvider(string filter, bool multisel)
            : base(new string[] { ParamsNames.FileNames }, new System.Windows.Forms.OpenFileDialog())
        {
            _multisel = multisel;
            _filter = filter;
        }



        override public string[] QueryParam(string param)
        {
            if (param == ParamsNames.FileNames)
                return ((System.Windows.Forms.OpenFileDialog)(this._underlyingCmnDialog)).FileNames;
            throw new SharksHunter.TransferObjects.Exceptions.ParamNotProvidedException(param);
        }

        override public void Initialize()
        {
            ((System.Windows.Forms.OpenFileDialog)(this._underlyingCmnDialog)).Multiselect = _multisel;
            ((System.Windows.Forms.OpenFileDialog)(this._underlyingCmnDialog)).Filter = _filter;
        }
    }
}
